package com.dream.style.app.ac.acc;


import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.dream.style.R;
import com.dream.style.app.ac.help.ViewHelper;
import com.dream.style.app.ac.main.KztActivity;

public class LoginActivity extends AppCompatActivity {

    private Button login;
    private TextView register,forget;
    private EditText etTel,etPsw;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        initView();
        initEvent();
    }

    private void initEvent() {
        // 密码显示监听
        ViewHelper.seePsw(this,etPsw);

        //登录
         login.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Toast.makeText(LoginActivity.this,
                            "登录成功！",Toast.LENGTH_SHORT).show();
                    start(KztActivity.class);
                }
            });

        register.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                start(RegisterActivity.class);
            }
        });

        forget.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                start(ForgetPswActivity.class);
            }
        });



    }

    private void initView() {
        login = findViewById(R.id.btn_login);
        register = findViewById(R.id.tv_register);
        forget = findViewById(R.id.tv_forget_psw);
        etTel = findViewById(R.id.et_tel);
        etPsw = findViewById(R.id.et_psw);
    }


    private void start(Class s){
        Intent i = new Intent(this,s);
        startActivity(i);
        finish();
    }


}

